<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo ($head_tittle); ?></title>
<link href="/my/sharkcms/Public/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="/my/sharkcms/Public/home/css/style.css" rel="stylesheet" type="text/css" />
<link href="/my/sharkcms/Public/home/css/index.css" rel="stylesheet" type="text/css" />
<script src="/my/sharkcms/Public/js/jquery.js"></script>
<script src="/my/sharkcms/Public/home/js/view.js"></script>
<title><?php echo ($pageconfig["tittle"]); ?></title>
<script>
$(document).ready(function(){
	//退出登录页面
   $('.outlogin').click(function(){                   
      var url="<?php echo U('Public/outlogin');?>";
      $.post(url,function(data){
	     $(".logininfor").html('<a href="<?php echo U("Index/login");?>" style=" color:#B61D1D;">&nbsp;您好，&nbsp;&nbsp;请登录</a>&nbsp;&nbsp;<a href="<?php echo U("Index/reg");?>">免费注册</a>');
	  });
	  return false;

   });
   $(".head_line2_wrap_li1").click(function(){
	  	  var url="<?php echo U('index');?>";
	  	  window.location.href=url;
   });
});
</script>

</head>

<body>
<div class="header">
   <div class="head_line1_wrap" align="center">
      <div class="head_line_center" >
	       <div class="fl">欢迎访问霞客系统</div>
		   <div class="fr logininfor">
		   	<?php if(session('uid')): ?><a href="<?php echo U("User/index");?>" class="loginname"><?php echo getUserName(session('uid'));?></a>&nbsp;&nbsp;<a href="#" class="outlogin">[退出]</a>
               <?php else: ?>
                  <a href="<?php echo U('Index/login');?>" style=" color:#B61D1D;">&nbsp;您好，&nbsp;&nbsp;请登录</a>&nbsp;&nbsp;<a href="<?php echo U('Index/reg');?>">免费注册</a><?php endif; ?>
		   </div>
	  </div>
	</div>
	<div class="head_line2_wrap" align="center">
      <div class="head_line_center" >
          <div class="head_line2_wrap_li1" style="cursor:pointer"></div> 
		  <div class="head_line2_wrap_li2">
		        <div class="fl"><input type="text" class="head_line2_wrap_li2_input" /></div>
				<div class="fr"><input type="submit" value="搜索" class="head_line2_wrap_li2_submit" /></div>
				<div class="clear"></div>
		  </div>
		  <div class="head_line2_wrap_li3">
		        <div class="head_line2_wrap_li3_l" onclick="window.location.href='<?php echo U(shop);?>'">购物车<?php echo count($_SESSION['shop']);?></div>
				<div class="head_line2_wrap_li3_r">去结算</div>
		  </div>  
	  </div>
	</div>
	<div class="head_line3_wrap" align="center">
	     <div class="head_line_center" >
		      <div class="head_line3_l">商品分类导航</div>
<style>
.xiake li{ font-family:"microsoft yahei"; font-size:15px; cursor:pointer;}
.xiake li a{ display:block;}
.xiake li .focus{color:#B1191A;font-weight: bold;}
</style>			  
			  <ul class="fl xiake">
			      <li><a href="<?php echo U('Index/index');?>" <?php if(I('name') == null): ?>class="focus"<?php endif; ?>>首页</a></li> 
			      <li>
			          <a href="<?php echo U('Index/goodsList',array('lid'=>10,'name'=>'jiadian'));?>" <?php if(I('name') == jiadian): ?>class="focus"<?php endif; ?> >
			               家用电器
			          </a>
			      </li> 
			      <li>
			           <a href="<?php echo U('Index/goodsList',array('lid'=>12,'name'=>'jiaju'));?>" <?php if(I('name') == jiaju): ?>class="focus"<?php endif; ?> >
			               家居家纺
			           </a>
			      </li>
			      <li>
				      <a href="<?php echo U('Index/goodsList',array('lid'=>13,'name'=>'fuzhuang'));?>" <?php if(I('name') == fuzhuang): ?>class="focus"<?php endif; ?> >
				           服装箱包
				      </a>
			      </li>
			      <li>
				      <a href="<?php echo U('Index/goodsList',array('lid'=>14,'name'=>'huazhuang'));?>" <?php if(I('name') == huazhuang): ?>class="focus"<?php endif; ?> >
				           个护化妆
				      </a>
			      </li>
			      <li>
			          <a href="<?php echo U('Index/goodsList',array('lid'=>21,'name'=>'wenhua'));?>" <?php if(I('name') == wenhua): ?>class="focus"<?php endif; ?> >
			                书籍文化
			          </a>
			      </li>
<!-- 			      <li><a href="">顾客留言</a></li> -->
			      <li><a href="<?php echo U('User/index');?>" >会员中心</a></li>
			  </ul>
		 </div>
	</div>
	
</div>


<div class="main">
    <div>
	  <style>
	   .tyh tr td{ text-align:center;}  
	  </style>
	  <?php if(!empty($shop)): ?><form action="<?php echo U('Index/goods_order');?>" method="post">
	  <table align="center" width="800px" class="tyh" style=" margin:0px auto;">
	        <tr><td colspan="7" ><div style="text-align:left; background:#CCCCCC; height:25px; line-height:25px;">&nbsp;&nbsp;&nbsp;&nbsp;购物车</div></td></tr>
			<tr><td>选择</td><td>图像</td><td>名称</td><td>单价</td><td>数量</td><td>价格</td><td>操作</td></tr>
	     <?php if(is_array($shop)): $i = 0; $__LIST__ = $shop;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$shops): $mod = ($i % 2 );++$i;?><tr bgcolor="#CC9966">
			   <td width="100px"><input name="check[]" class="shopcheck" type="checkbox" value="<?php echo ($shops["go_id"]); ?>" checked /></td>
			   <td><img src="<?php echo getalbumface($shops['go_pics']);?>"  width="30px" height="30px"/></td>
			   <td><?php echo ($shops['go_name']); ?></td>
			   <td class="danjia"><?php echo ($shops['go_value']); ?></td>
			   <td>
			      <input type="text" class="ajaxnum" name="number[]" value="<?php echo ($shops['shop_num']); ?>"  style="width:40px; text-align:center;"/>
				  <input type="hidden" class="ajaxid" value="<?php echo ($shops["id"]); ?>" />  
				</td>
			   <td class="shopvalue"><?php echo ($shops['go_value']*$shops['shop_num']); ?></td>
			   <td><div class="shopdel" style="color:#FF0000; font-size:20px; cursor:pointer;">x</div></td>
			 </tr><?php endforeach; endif; else: echo "" ;endif; ?>
			 <tr><td colspan="7" bgcolor="#999999" height="30px">
			        <div   style="float:left;">&nbsp;&nbsp;&nbsp;已选商品<font class="shopnum" style="color:#FF3300; font-weight:bold; font-size:20px;"></font>件</div>
					<div style="float:left; cursor:pointer;" class="clearshop">清空购物车</div>
					<div style=" float:right;"><input type="submit" value="去结算" style="float:right; width:100px; height:30px; background:#FF0000; color:#FFFFFF; line-height:30px; border:0px; cursor:pointer;" /></div>
					<div  style="float:right;">总价（不包含运费）<font class="shoptotal" style="color:#FF3300; font-weight:bold; font-size:20px;"></font>元&nbsp;&nbsp;&nbsp;</div>
			 </td></tr>
	  </table>
	</form>
	<?php else: ?>
	<!-- 购物车为空 -->
	<div class="emptycart">
		 <div class="emptycart_bg fl"></div>
		 <div class="fl emptycart_text">
			 购物车空空的哦~，去看看心仪的商品吧~
			 <br/><a class="colorred" href="<?php echo U('index');?>">去购物></a>
		 </div>
	</div><?php endif; ?>
	</div>
</div>
<div class="xiakeappend"></div>
<div class="clear"></div>
<div class="foot">
   <div class="foot_title">
   	    <div class="foot_main foot_titleli">
   	    	  <ul>
   	    	  	   <li class="fl">
   	    	  	   	   <span class="footicon">霞</span>
   	    	  	   	   <span class="foottitle">品质保证不错不错</span>
   	    	  	   </li>
   	    	  	   <li class="fl">
   	    	  	   	   <span class="footicon">客</span>
   	    	  	   	   <span class="foottitle">物超所值不错不错</span>
   	    	  	   </li>
   	    	  	   <li class="fl">
   	    	  	   	   <span class="footicon">网</span>
   	    	  	   	   <span class="foottitle">无理由退货不错不错</span>
   	    	  	   </li>
   	    	  	   <li class="fl">
   	    	  	   	   <span class="footicon">络</span>
   	    	  	   	   <span class="foottitle">不错不错不错不错</span>
   	    	  	   </li>
   	    	  </ul>
   	    </div>
   </div>
   <div style="background:#fff;">
    	<div class="foot_main foot_wrap">
    	      <ul>
    	      	  <li class="fl">
    	      	       <span class="title">购物指南</span>
    	      	       <br/>购物流程
    	      	       <br/>会员介绍
    	      	       <br/>生活旅行/团购
    	      	       <br/>常见问题
    	      	       <br/>大家电
    	      	       <br/>联系客服
    	      	  </li>
    	      	  <li class="fl">
    	      	       <span class="title">购物指南</span>
    	      	       <br/>购物流程
    	      	       <br/>会员介绍
    	      	       <br/>生活旅行/团购
    	      	       <br/>常见问题
    	      	       <br/>大家电
    	      	       <br/>联系客服
    	      	  </li>
    	      	  <li class="fl">
    	      	       <span class="title">购物指南</span>
    	      	       <br/>购物流程
    	      	       <br/>会员介绍
    	      	       <br/>生活旅行/团购
    	      	       <br/>常见问题
    	      	       <br/>大家电
    	      	       <br/>联系客服
    	      	  </li>
    	      	  <li class="fl">
    	      	       <span class="title">购物指南</span>
    	      	       <br/>购物流程
    	      	       <br/>会员介绍
    	      	       <br/>生活旅行/团购
    	      	       <br/>常见问题
    	      	       <br/>大家电
    	      	       <br/>联系客服
    	      	  </li>
    	      	  <li class="fl">
    	      	       <span class="title">购物指南</span>
    	      	       <br/>购物流程
    	      	       <br/>会员介绍
    	      	       <br/>生活旅行/团购
    	      	       <br/>常见问题
    	      	       <br/>大家电
    	      	       <br/>联系客服
    	      	  </li>
    	      </ul>
    	</div>
    </div>
    <div class="clear"></div>
    <div>
    	<div class="foot_main" align="center" style="height:50px; line-height:50px;">
    		Copyright © 2016-2025 霞客网络 版权所有 保留一切权利 备案号:闽00-785356985号
    	</div>
    </div>

</div>
</body>
</html>

<script>
$(document).ready(function(){
   var shopnum=$(".shopcheck").length;//购物车内商品数量
	  var $subtotal=0;
	  for(var $i=0;$i<shopnum;$i++){
	     $subtotal=$subtotal+parseInt($(".shopcheck").parent().parent().eq($i).find(".shopvalue").text());
	  }
	  $(".shopnum").text(shopnum);
      $(".shoptotal").text($subtotal);
	  var  shengyuvalue=$subtotal;
        $(".shopcheck").change(function(){  //去掉多选框后
            var shopnum=$(".shopcheck:checked").length;//购物车内商品数量
		    $(".shopnum").text(shopnum);
			var changevaue=$(this).parent().parent().find(".shopvalue").text()
			 
			 if($(this).is(":checked")){
			     shengyuvalue=shengyuvalue+parseInt(changevaue);
			     $(this).parent().parent().find(".ajaxnum").attr('name',"number[]");
			 }else{
			 	 shengyuvalue=shengyuvalue-parseInt(changevaue);
			 	 $(this).parent().parent().find(".ajaxnum").attr('name',"");
			 }
			$(".shoptotal").text(shengyuvalue);
	    });
		
		
		$(".shopdel").click(function(){                                   //删除购物车内一件商品
		  var $ajaxnum=$(this).parent().parent().find(".ajaxnum").val();
		  var $ajaxid=$(this).parent().parent().find(".ajaxid").val();
		  var jianvalue=$(this).parent().parent().find(".shopvalue").text() 
		      $.post("http://localhost/shop/index.php/Index/shopajax",{action:"del",id:$ajaxid});
			  $(this).parent().parent().remove();
			  $(".shoptotal").text(parseInt($(".shoptotal").text())-parseInt(jianvalue));
		});
		
		$(".ajaxnum").change(function(){
		  var $ajaxnum=$(this).parent().parent().find(".ajaxnum").val();
		  var $ajaxid=$(this).parent().parent().find(".ajaxid").val();
          var shopnum=$(".shopcheck:checked").length;//购物车内商品数量
		      $subtotal=0;
		   $.post("http://localhost/shop/index.php/Index/shopajax",{action:"editnum",id:$ajaxid,num:$(this).val()});
		   $(this).parent().parent().find(".shopvalue").text($(this).parent().parent().find(".danjia").text()*$ajaxnum);
		   	  for(var $i=0;$i<shopnum;$i++){
	              $subtotal=$subtotal+parseInt($(".shopcheck").parent().parent().eq($i).find(".shopvalue").text());
	          }
		   $(".shoptotal").text($subtotal);
		});
		
		$(".clearshop").click(function(){                 //清空购物车
		  var $ajaxid=$(this).parent().parent().find(".ajaxid").val();
		     $.post("http://localhost/shop/index.php/Index/shopajax",{action:"clear",id:$ajaxid});
		});

});
</script>

</body>
</html>